Skip to content

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Jul 1, 2025

#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note

As discussed on the Zulip thread above, I want to make -Ztrack-diagnostics emit like a note. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, even in the middle of a snippet, seems like something that should be changed. Turning it into a note seems like the best choice, as it would align it with the rest of the output, and note is already used for somewhat similar things, like seeing why a lint was fired.


Note: turning -Ztrack-diagnostics into a note will also make annotate-snippets API a bit cleaner

@rustbot
Copy link
Collaborator

rustbot commented Jul 1, 2025

r? @WaffleLapkin

rustbot has assigned @WaffleLapkin.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 1, 2025
@petrochenkov
Copy link
Contributor

It's now emitted as a note into the json output as well, right?

Could you then migrate tests using -Ztrack-diagnostics from //@ error-pattern: created at to //~ NOTE created at?
All of them are either in tests\ui\track-diagnostics or in tests\rustdoc-ui\track-diagnostics.rs.

//@ dont-require-annotations: NOTE can be used to keep the NOTE annotations non-viral, if necessary.

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from b528aba to dc4877b Compare July 1, 2025 19:22
@Muscraft
Copy link
Member Author

Muscraft commented Jul 1, 2025

It's now emitted as a note into the json output as well, right?

No, I only made it so that it gets rendered like a note in HumanEmitter

Could you then migrate tests using -Ztrack-diagnostics from //@ error-pattern: created at to //~ NOTE created at?
All of them are either in tests\ui\track-diagnostics or in tests\rustdoc-ui\track-diagnostics.rs.

//@ dont-require-annotations: NOTE can be used to keep the NOTE annotations non-viral, if necessary.

Since this isn't changing the json, would you still like me to do this?

@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

Since this isn't changing the json, would you still like me to do this?

Compiletest is working on the json output, so //~ NOTE won't work if the output is not there.
Ideally this would be actually outputted in some structured form, and not just into the rendered text.

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from dc4877b to e47cd86 Compare July 1, 2025 22:39
@rustbot
Copy link
Collaborator

rustbot commented Jul 1, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from e47cd86 to 6d3ffe1 Compare July 1, 2025 22:47
@Muscraft
Copy link
Member Author

Muscraft commented Jul 1, 2025

Ideally this would be actually outputted in some structured form, and not just into the rendered text.

I don't know how I would add it to the JSON output, but if I need to, I'll see what I can figure out.

@WaffleLapkin
Copy link
Member

@Muscraft I think making it a "normal" note would be better than special casing display. So please do try it.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 2, 2025
@Muscraft Muscraft force-pushed the track-diagnostics-note branch 2 times, most recently from 64745dc to 3a82c35 Compare July 3, 2025 03:07
@rust-log-analyzer

This comment has been minimized.

@Muscraft Muscraft force-pushed the track-diagnostics-note branch from 3a82c35 to f361b92 Compare July 3, 2025 04:19
@Muscraft Muscraft force-pushed the track-diagnostics-note branch from f361b92 to 6bef238 Compare July 3, 2025 13:19
@Muscraft
Copy link
Member Author

Muscraft commented Jul 3, 2025

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 3, 2025
Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@WaffleLapkin
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 4, 2025

📌 Commit 6bef238 has been approved by WaffleLapkin

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 4, 2025
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 4, 2025
bors added a commit that referenced this pull request Jul 4, 2025
Rollup of 7 pull requests

Successful merges:

 - #140643 (Refactor StableMIR)
 - #143286 (Make -Ztrack-diagnostics emit like a note)
 - #143308 (Remove `PointerLike` trait)
 - #143387 (Make __rust_alloc_error_handler_should_panic a function)
 - #143400 (Port `#[rustc_pass_by_value]` to the new attribute system)
 - #143417 (bump termize dep)
 - #143420 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 324aa5d into rust-lang:master Jul 4, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 4, 2025
rust-timer added a commit that referenced this pull request Jul 4, 2025
Rollup merge of #143286 - Muscraft:track-diagnostics-note, r=WaffleLapkin

Make -Ztrack-diagnostics emit like a note

[#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Rendering.20-Ztrack-diagnostics.20like.20a.20note/with/526608647)

As discussed on the Zulip thread above, I want to make `-Ztrack-diagnostics` emit like a `note`. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, [even in the middle of a snippet](https://github.com/rust-lang/rust/blob/86e05cd300fac9e83e812c4d46582b48db780d8f/tests/ui/track-diagnostics/track6.stderr), seems like something that should be changed. Turning it into a `note` seems like the best choice, as it would align it with the rest of the output, and `note` is already used for somewhat similar things, like seeing why a lint was fired.

---

Note: turning `-Ztrack-diagnostics` into a `note` will also make `annotate-snippets` API a bit cleaner
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jul 7, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#140643 (Refactor StableMIR)
 - rust-lang/rust#143286 (Make -Ztrack-diagnostics emit like a note)
 - rust-lang/rust#143308 (Remove `PointerLike` trait)
 - rust-lang/rust#143387 (Make __rust_alloc_error_handler_should_panic a function)
 - rust-lang/rust#143400 (Port `#[rustc_pass_by_value]` to the new attribute system)
 - rust-lang/rust#143417 (bump termize dep)
 - rust-lang/rust#143420 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@Muscraft Muscraft deleted the track-diagnostics-note branch July 7, 2025 13:59
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 10, 2025
…=WaffleLapkin

Make -Ztrack-diagnostics emit like a note

[#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Rendering.20-Ztrack-diagnostics.20like.20a.20note/with/526608647)

As discussed on the Zulip thread above, I want to make `-Ztrack-diagnostics` emit like a `note`. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, [even in the middle of a snippet](https://github.com/rust-lang/rust/blob/86e05cd300fac9e83e812c4d46582b48db780d8f/tests/ui/track-diagnostics/track6.stderr), seems like something that should be changed. Turning it into a `note` seems like the best choice, as it would align it with the rest of the output, and `note` is already used for somewhat similar things, like seeing why a lint was fired.

---

Note: turning `-Ztrack-diagnostics` into a `note` will also make `annotate-snippets` API a bit cleaner
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
…=WaffleLapkin

Make -Ztrack-diagnostics emit like a note

[#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Rendering.20-Ztrack-diagnostics.20like.20a.20note/with/526608647)

As discussed on the Zulip thread above, I want to make `-Ztrack-diagnostics` emit like a `note`. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, [even in the middle of a snippet](https://github.com/rust-lang/rust/blob/86e05cd300fac9e83e812c4d46582b48db780d8f/tests/ui/track-diagnostics/track6.stderr), seems like something that should be changed. Turning it into a `note` seems like the best choice, as it would align it with the rest of the output, and `note` is already used for somewhat similar things, like seeing why a lint was fired.

---

Note: turning `-Ztrack-diagnostics` into a `note` will also make `annotate-snippets` API a bit cleaner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants